﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace winformApplication
{
    public class OperationContext
    {
        private Operation op;

        public OperationContext(double _opA, double _opB, string _op)
        {
            switch (_op)
            {
                case "+":
                    op = new OperationAdd(_opA, _opB);
                    break;
                case "-":
                    op = new OperationSub(_opA, _opB);
                    break;
                case "*":
                    op = new OperationMulti(_opA, _opB);
                    break;
                case "/":
                    op = new OperationDevide(_opA, _opB);
                    break;
                case "^":
                    op = new OperationPow(_opA, _opB);
                    break;
            }
        }

        public double getResult()
        {
            return op.getResult();
        }
    }
}
